const sequelize = require('sequelize')
const db = require('@/database')

//定义user数据表模型
const User = db.define('aa_users', {
    id: {
        type: sequelize.INTEGER,
        primaryKey: true,//主键
        autoIncrement: true,//自动增长
        allowNull: false,//不允许为空
        field: 'id',
        comment: '主键,用户ID'
    },
    username: {
        type: sequelize.STRING(),
        allowNull: false,
        field: 'username',
        comment: '用户名'
    },
    password: {
        type: sequelize.STRING(),
        allowNull: false,
        field: 'password',
        comment: '密码'
    },
    phone: {
        type: sequelize.STRING(),
        allowNull: false,
        field: 'phone',
        comment: '手机号'
    },
    sta: {
        type: sequelize.INTEGER(),
        allowNull: false,
        field: 'sta',
        comment: '状态:1为用户,0为管理员',
        defaultValue: 1
    }
}, { timestamps: true, updatedAt: false });
//抛出模型
module.exports = User